"""this script parse the content of a xml file"""
from PyQt5.QtWidgets import QWidget
from PyQt5.QtCore import pyqtSignal
from ui.main_ui.Ui_main_page import Ui_Form as Main_Dialog


class UIOperate(QWidget):
    """Summary of class here.
       界面信号事件
    """
    signal_main_zh_price_show = pyqtSignal(str, str, str)
    signal_main_qiu_price_show = pyqtSignal(str, str, str)

    def __init__(self):
        super(UIOperate, self).__init__()

        #主界面初始化
        self.main_dialog = Main_Dialog()
        self.init_main_dialog = QWidget()
        self.main_dialog.setupUi(self.init_main_dialog)
        self.init_main_dialog.show()

        self.signal_main_zh_price_show.connect(self.__set_zh_price)
        self.signal_main_qiu_price_show.connect(self.__set_qiu_price)

    def __set_zh_price(self, i, price_j, price_y):
        """
        设置战魂价格
        :param :None
        :return:None
        """
        try:
            exec("self.main_dialog.zhanhun_j_"+ i + ".setText(\""+ price_j + "\")")
            exec("self.main_dialog.zhanhun_y_"+ i + ".setText(\""+ price_y + "\")")
        except:
            print("打印错误")

    def __set_qiu_price(self, qiu_type, price_j, price_y):
        """
        设置秋价格
        :param :None
        :return:None
        """
        try:
            exec("self.main_dialog." + qiu_type + "_j.setText(\""+ price_j + "\")")
            exec("self.main_dialog." + qiu_type + "_y.setText(\""+ price_y + "\")")
        except:
            print("打印错误")



if __name__ == '__main__':
    pass
